<template>
  <el-row>
    <el-col :span="22" :offset="1">

      <!--卡片shart-->
      <el-card class="box-card" style="padding: 0 15px;">

        <el-row>
          <el-col :span="22" :offset="1">
            <div style="width: 100%;line-height: 40px">
              <el-button type="primary" plain style="margin-left: 1000px" @click="addOne()">新增盘点</el-button>
            </div>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="8" style="line-height: 40px">
            <div class="grid-content bg-purple">
              <span class="demonstration">创建时间</span>
              <el-date-picker
                v-model="druginfo.inventoryDate"
                type="daterange"
                align="right"
                unlink-panels
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :picker-options="pickerOptions">
              </el-date-picker>
            </div>
          </el-col>
          <el-col :span="6" style="line-height: 40px"><div class="grid-content bg-purple">
            <el-input placeholder="请输入内容" v-model="input_search" class="input-with-select">
              <el-button slot="append" icon="el-icon-search"></el-button>
            </el-input>
          </div></el-col>
        </el-row>


        <el-table
          :data="druginfo"
          :header-cell-style="{background:'#C2C5F6',color:'#0a0a0d','text-align':'center','line-height': '40px'}"
          style="width: 100%;"
          :cell-style="{'text-align':'center'}">>
          <el-table-column
            type="index"
            label="序号"
            width="180">
          </el-table-column>

          <el-table-column
            prop="inventoryNum"
            label="盘点单号"
            width="180">
          </el-table-column>

          <el-table-column
            prop="inventoryDate"
            label="盘点日期"
            width="180">
          </el-table-column>

          <el-table-column
            prop="creater"
            label="制单人"
            width="180">
          </el-table-column>
          <el-table-column
            prop="inventoryStatus"
            label="盘点状态"
            width="180">
          </el-table-column>


          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                @click="handleEdit(scope.$index, scope.row)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="block">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[5, 10, 15, 20]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="10">
          </el-pagination>
        </div>

      </el-card>
      <!--卡片end-->

    </el-col>
  </el-row>
</template>

<script>
  export default {
    data() {
      return {
        pickerOptions: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        },
        input_search: '',
        druginfo:[],
        currentPage4: 4
      }
    },
    methods:{
      addOne(){
        alert("xinzeng");

      },
      //分页
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      //操作
      handleEdit(index, row) {
        console.log(index, row);
        this.$router.push("/drugStockTakingDetail")
      },
      findAll:function () {
        this.druginfo=[{
          inventoryNum:111,
          inventoryDate:111,
          creater:'张三',
          inventoryStatus:'正在盘点'
        }]
      }
    },
    mounted(){
      this.findAll();
    }
  }
</script>

<style>
  .el-row {
    margin-bottom: 20px;
  &:last-child {
     margin-bottom: 0;
   }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: white;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>

